Skip to content

ci: harden GitHub Actions against supply chain attacks#4606

Closed
kakkoyun wants to merge 1 commit into
DataDog:mainfrom
kakkoyun:ci/harden-gha-supply-chain
Closed

ci: harden GitHub Actions against supply chain attacks#4606
kakkoyun wants to merge 1 commit into
DataDog:mainfrom
kakkoyun:ci/harden-gha-supply-chain

Conversation

@kakkoyun

Copy link
Copy Markdown
Member

What does this PR do?

Adds persist-credentials: false to all 56 actions/checkout steps across 22 workflow files and the test-apps.cue CUE template (which regenerates test-apps.yml). Also adds explicit permissions: blocks to 6 workflows that were inheriting repo defaults, and fixes two stale/missing version comments.

Motivation

actions/checkout defaults to persist-credentials: true, which stores GITHUB_TOKEN in .git/config as http.https://github.com/.extraheader for the lifetime of the job. Any subsequent step — including third-party actions — can read that credential and use it to push code, create releases, or access private repos. This is the primary vector used in the tj-actions/changed-files supply chain attack.

Setting persist-credentials: false eliminates this residual credential exposure. The one workflow that performs a git push (sync-cue-actions.yml) now injects credentials via git remote set-url scoped only to that step.

Reviewer's Checklist

  • New code is free of linting errors. You can check this by running make lint locally.
  • All generated files are up to date (test-apps.yml regenerated from test-apps.cue).
  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Add `persist-credentials: false` to all 56 actions/checkout steps across
22 workflow files and the test-apps.cue template (regenerated test-apps.yml).
This prevents GITHUB_TOKEN from being stored in .git/config after checkout,
eliminating the primary vector used in supply chain attacks like the
tj-actions/changed-files incident.

sync-cue-actions.yml still performs a git push; it now injects credentials
via `git remote set-url` scoped only to that step rather than persisting
them for all subsequent steps.

Also add explicit `permissions:` blocks to 6 workflows that were inheriting
repo defaults, and fix two stale/missing version comments on checkout steps.
@codecov

codecov Bot commented Mar 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.69%. Comparing base (ee1fdc0) to head (d043692).

Additional details and impacted files

see 265 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kakkoyun kakkoyun closed this Mar 26, 2026
@kakkoyun

Copy link
Copy Markdown
Member Author

Opened in the fork by mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant